angular.module('meHistoryOrderDelservices', [])

  .factory('MeHistoryOrderDel', function ($resource, $rootScope, ENV) {

    //设置访问接口路径
    var APIUrl = ENV.api;

    //访问获取用户信息的接口
    var deleteWineInHistoryOrderResource = $resource(APIUrl + "meHistoryWine/deleteWineInHistoryOrder.do");

    var deleteWineFromOrderJson;



    var orderDetailName;
    var orderWineList;
    var mrwId;

    return {

      setMrwId: function (mrw_id) {
        mrwId = mrw_id;
      },
      getMrwId: function () {
        return mrwId;
      },
      setOrderDetailName: function (mrw_name) {
        orderDetailName = mrw_name;
      },
      getOrderDetailName: function () {
        return orderDetailName;
      },
      setOrderWineList: function (wineList) {
        orderWineList = wineList;
      },
      getOrdrWineList: function () {
        return orderWineList;
      },


      deleteWineFromOrder : function (mrwId,updateList) {
        console.log(updateList);
        deleteWineInHistoryOrderResource.save(
          {
            mrw_id : mrwId,
            updataList : updateList
          },
          function (data) {
            deleteWineFromOrderJson = data;
            $rootScope.$broadcast('Me.deleteWineFromOrder');
          }
        );
      },

      getDeleteWineFromOrderJson : function (){
        return deleteWineFromOrderJson;
      }


    }
  });
